home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
DOS Vuser Deluxe 2003 October
/
DOS Vuser Deluxe 2003 Oct - Disc 1.iso
/
SKIN
/
Le Crapouillot.wmz
/
CrapouillotAnim.JS
< prev
next >
Wrap
Text File
|
2002-02-02
|
17KB
|
464 lines
/*#######################
//initial values
########################*/
var AMXq = 7;
var debugAMX = false;
var defaultSpriteWidth=110;
var defaultSpriteHeight=110;
var AMXMoveTime = 500;
var AMXtimeoutDecrement = 1;
var AMXinterval = 10;
var mustMaximize = false;
/*#######################
//initial sprites creation
########################*/
function setSpriteObjects(){
printToDebug('setspriteobjects');
/*
create the sprites at initial position, state and scenario
*/
AMXs[0]=new sprite('allScen', 'options_wait_closed',61,41,0,0, 0,0,0);
AMXs[1]=new sprite('allScen', 'eq_wait_closed',56,164,0,0, 0,0,0);
AMXs[2]=new sprite('allScen', 'main_steady',35,57,0,0, 0,0,0);
AMXs[3]=new sprite('allScen', 'rightleg_open',54,158,0,0, 0,0,0);
//AMXs[4]=new sprite('allScen', 'tail_wait_open',173,54,0, 0,0,0);
AMXs[4]=new sprite('allScen', 'tail_open',83,144,0, 0,0,0);
AMXs[5]=new sprite('allScen', 'leftleg_open',84,198,0,0, 0,0,0);
AMXs[6]=new sprite('allScen', 'playlist_wait_closed',130,200,0,0, 0,0,0);
printToDebug('setspriteobjects done');
}
/*#######################
//states & scenarios definition
########################*/
function initStates(){
printToDebug('initstates');
/*
defines the different states and scenarios
*/
states = new Array;
/*##########
allScen state - each state has several scenarios
###########*/
/* allScen */
st_n = "allScen";
states[ st_n] = new state;
states[ st_n].onErrorScenario = "options_wait_closed";
states[ st_n].z = 3;
states[ st_n].absolutePos = true;
states[ st_n ].scenarios["options_open"] = new scenario;
with (states[ st_n ].scenarios["options_open"]) {
random_delay = 0;
steps[0] = new step( st_n, "OPTIONS.gif", 20, 18, 11);
next_scenarios[0] = new next_scenario("options_wait_open",1);
next_states[0] = new next_state("allScen", "options_wait_open", 1);
}
states[ st_n ].scenarios["options_close"] = new scenario;
with (states[ st_n ].scenarios["options_close"]) {
random_delay = 0;
steps[0] = new step( st_n, "OPTIONS.gif", 61, 91, 11);
next_scenarios[0] = new next_scenario("options_wait_closed",1);
next_states[0] = new next_state("allScen", "options_wait_closed", 1);
}
states[ st_n ].scenarios["options_wait_open"] = new scenario;
with (states[ st_n ].scenarios["options_wait_open"]) {
random_delay = 0;
steps[0] = new step( st_n, "OPTIONS.gif", 20, 18, 510);
next_scenarios[0] = new next_scenario("options_close",1);
next_states[0] = new next_state("allScen", "options_close", 1);
}
states[ st_n ].scenarios["options_wait_closed"] = new scenario;
with (states[ st_n ].scenarios["options_wait_closed"]) {
random_delay = 0;
steps[0] = new step( st_n, "OPTIONS.gif", 61, 91, 20000);
next_scenarios[0] = new next_scenario("options_wait_closed",1);
next_states[0] = new next_state("allScen", "options_wait_closed", 1);
onmouseover_zones[0] = new on_zone( 0, 0, 115, 115 );
onmouseover_zones[0].next_states[0] = new next_state("allScen", "options_open", 50);
}
states[ st_n ].scenarios["eq_open"] = new scenario;
with (states[ st_n ].scenarios["eq_open"]) {
random_delay = 0;
steps[0] = new step( st_n, "eq.gif", 170, 170, 11);
next_scenarios[0] = new next_scenario("eq_wait_open",1);
next_states[0] = new next_state("allScen", "eq_wait_open", 1);
}
states[ st_n ].scenarios["eq_close"] = new scenario;
with (states[ st_n ].scenarios["eq_close"]) {
random_delay = 0;
steps[0] = new step( st_n, "eq.gif", 56, 164, 11);
next_scenarios[0] = new next_scenario("eq_wait_closed",1);
next_states[0] = new next_state("allScen", "eq_wait_closed", 1);
}
states[ st_n ].scenarios["eq_wait_open"] = new scenario;
with (states[ st_n ].scenarios["eq_wait_open"]) {
random_delay = 0;
steps[0] = new step( st_n, "eq.gif", 170, 170, 510);
next_scenarios[0] = new next_scenario("eq_close",1);
next_states[0] = new next_state("allScen", "eq_close", 1);
next_states[0].action="closePlaylist();";
}
states[ st_n ].scenarios["eq_wait_closed"] = new scenario;
with (states[ st_n ].scenarios["eq_wait_closed"]) {
random_delay = 0;
steps[0] = new step( st_n, "eq.gif", 56, 164, 20000);
next_scenarios[0] = new next_scenario("eq_wait_closed",1);
next_states[0] = new next_state("allScen", "eq_wait_closed", 1);
}
states[ st_n ].scenarios["main_steady"] = new scenario;
with (states[ st_n ].scenarios["main_steady"]) {
random_delay = 0;
steps[0] = new step( st_n, "crapouillot.gif", 35, 107, 20000);
next_scenarios[0] = new next_scenario("main_steady",1);
next_states[0] = new next_state("allScen", "main_steady", 1);
}
states[ st_n ].scenarios["main_moving"] = new scenario;
with (states[ st_n ].scenarios["main_moving"]) {
random_delay = 0;
steps[0] = new step( st_n, "crapouillot.gif", 35, 107, 200);
steps[1] = new step( st_n, "crapouillot-geckofeeling.gif", 35, 107, 200);
next_scenarios[0] = new next_scenario("main_steady",1);
next_states[0] = new next_state("allScen", "main_steady", 1);
next_states[0].action="eyeHoverControl.visible='true';";
}
states[ st_n ].scenarios["rightleg_wait_open"] = new scenario;
with (states[ st_n ].scenarios["rightleg_wait_open"]) {
random_delay = 0;
steps[0] = new step( st_n, "RIGHTLEG.gif", 4, 158, 120);
next_scenarios[0] = new next_scenario("rightleg_wait_open",1);
next_scenarios[1] = new next_scenario("rightleg_closeboth",2);
next_states[0] = new next_state("allScen", "rightleg_wait_open", 1);
}
states[ st_n ].scenarios["rightleg_closeboth"] = new scenario;
with (states[ st_n ].scenarios["rightleg_closeboth"]) {
random_delay = 0;
steps[0] = new step( st_n, "RIGHTLEG.gif", 4, 158, 0);
next_scenarios[0] = new next_scenario("rightleg_close",1);
next_states[0] = new next_state("allScen", "rightleg_close", 1);
next_states[0].action = "closeLeftLeg();";
}
states[ st_n ].scenarios["rightleg_open"] = new scenario;
with (states[ st_n ].scenarios["rightleg_open"]) {
random_delay = 0;
steps[0] = new step( st_n, "RIGHTLEG.gif", 54, 158, 1);
steps[1] = new step( st_n, "RIGHTLEG.gif", 54, 158, 10);
next_scenarios[0] = new next_scenario("rightleg_wait_open",1);
next_states[0] = new next_state("allScen", "rightleg_wait_open", 1);
}
states[ st_n ].scenarios["rightleg_openboth"] = new scenario;
with (states[ st_n ].scenarios["rightleg_openboth"]) {
random_delay = 0;
steps[0] = new step( st_n, "RIGHTLEG.gif", 54, 158, 0);
next_scenarios[0] = new next_scenario("rightleg_wait_open",1);
next_states[0] = new next_state("allScen", "rightleg_wait_open", 1);
next_states[0].action="openLeftLeg();";
}
states[ st_n ].scenarios["rightleg_close"] = new scenario;
with (states[ st_n ].scenarios["rightleg_close"]) {
random_delay = 0;
steps[0] = new step( st_n, "RIGHTLEG.gif", 54, 158, 1);
next_scenarios[0] = new next_scenario("rightleg_wait_closed",1);
next_states[0] = new next_state("allScen", "rightleg_wait_closed", 1);
}
states[ st_n ].scenarios["rightleg_wait_closed"] = new scenario;
with (states[ st_n ].scenarios["rightleg_wait_closed"]) {
random_delay = 0;
steps[0] = new step( st_n, "RIGHTLEG.gif", 54, 158, 1000);
next_scenarios[0] = new next_scenario("rightleg_wait_closed",3);
next_scenarios[1] = new next_scenario("rightleg_openboth",1);
next_states[0] = new next_state("allScen", "rightleg_wait_closed", 1);
}
states[ st_n ].scenarios["leftleg_wait_open"] = new scenario;
with (states[ st_n ].scenarios["leftleg_wait_open"]) {
random_delay = 0;
steps[0] = new step( st_n, "LEFTLEG.gif", 84, 248, 10000);
next_scenarios[0] = new next_scenario("leftleg_wait_open",1);
next_states[0] = new next_state("allScen", "leftleg_wait_open", 1);
}
states[ st_n ].scenarios["leftleg_open"] = new scenario;
with (states[ st_n ].scenarios["leftleg_open"]) {
random_delay = 0;
steps[0] = new step( st_n, "LEFTLEG.gif", 84, 198, 1);
steps[1] = new step( st_n, "LEFTLEG.gif", 84, 198, 10);
next_scenarios[0] = new next_scenario("leftleg_wait_open",1);
next_states[0] = new next_state("allScen", "leftleg_wait_open", 1);
}
states[ st_n ].scenarios["leftleg_close"] = new scenario;
with (states[ st_n ].scenarios["leftleg_close"]) {
random_delay = 0;
steps[0] = new step( st_n, "LEFTLEG.gif", 84, 198, 1);
next_scenarios[0] = new next_scenario("leftleg_wait_closed",1);
next_states[0] = new next_state("allScen", "leftleg_wait_closed", 1);
}
states[ st_n ].scenarios["leftleg_wait_closed"] = new scenario;
with (states[ st_n ].scenarios["leftleg_wait_closed"]) {
random_delay = 0;
steps[0] = new step( st_n, "LEFTLEG.gif", 84, 198, 10000);
next_scenarios[0] = new next_scenario("leftleg_wait_closed",1);
next_states[0] = new next_state("allScen", "leftleg_wait_closed", 1);
}
states[ st_n ].scenarios["tail_wait_open"] = new scenario;
with (states[ st_n ].scenarios["tail_wait_open"]) {
random_delay = 0;
steps[0] = new step( st_n, "TAIL.gif", 173, 54, 400);
next_scenarios[0] = new next_scenario("tail_wait_open",10);
next_scenarios[1] = new next_scenario("tail_wait_closed",1);
next_scenarios[2] = new next_scenario("tail_jiggle",2);
next_states[0] = new next_state("allScen", "tail_wait_open", 1);
}
states[ st_n ].scenarios["tail_wait_closed"] = new scenario;
with (states[ st_n ].scenarios["tail_wait_closed"]) {
random_delay = 0;
steps[0] = new step( st_n, "TAIL.gif", 83, 144, 100);
next_scenarios[0] = new next_scenario("tail_wait_closed",1);
next_scenarios[1] = new next_scenario("tail_open",2);
next_states[0] = new next_state("allScen", "tail_wait_closed", 1);
}
states[ st_n ].scenarios["tail_jiggle"] = new scenario;
with (states[ st_n ].scenarios["tail_jiggle"]) {
random_delay = 1;
steps[0] = new step( st_n, "TAIL.gif", 173, 54, 10);
steps[1] = new step( st_n, "TAIL2.gif", 173, 54, 1);
steps[2] = new step( st_n, "TAIL3.gif", 173, 54, 1);
steps[3] = new step( st_n, "TAIL2.gif", 173, 54, 3);
steps[4] = new step( st_n, "TAIL.gif", 173, 54, 20);
next_scenarios[0] = new next_scenario("tail_jiggle",2);
next_scenarios[1] = new next_scenario("tail_wait_open",1);
next_states[0] = new next_state("allScen", "tail_wait_open", 2);
}
states[ st_n ].scenarios["tail_open"] = new scenario;
with (states[ st_n ].scenarios["tail_open"]) {
random_delay = 1;
steps[0] = new step( st_n, "TAIL3.gif", 158, 69, 12);
steps[1] = new step( st_n, "TAIL.gif", 163, 64, 9);
steps[2] = new step( st_n, "TAIL2.gif", 168, 59, 1);
steps[3] = new step( st_n, "TAIL3.gif", 173, 54, 3);
next_scenarios[0] = new next_scenario("tail_jiggle",2);
next_scenarios[1] = new next_scenario("tail_wait_open",1);
next_states[0] = new next_state("allScen", "tail_wait_open", 1);
}
states[ st_n ].scenarios["playlist_wait_closed"] = new scenario;
with (states[ st_n ].scenarios["playlist_wait_closed"]) {
random_delay = 0;
steps[0] = new step( st_n, "PlayListBG.gif", 130, 200, 20000);
next_scenarios[0] = new next_scenario("playlist_wait_closed",1);
next_states[0] = new next_state("allScen", "playlist_wait_closed", 1);
}
states[ st_n ].scenarios["playlist_o1"] = new scenario;
with (states[ st_n ].scenarios["playlist_o1"]) {
random_delay = 0;
steps[0] = new step( st_n, "PlayListBG.gif", 130, 200, 10);
next_scenarios[0] = new next_scenario("playlist_o2",1);
next_states[0] = new next_state("allScen", "playlist_o2", 1);
next_states[0].action="AMXSubviewSprite6.height='30';AMXSubviewSprite6.visible='true';";
}
states[ st_n ].scenarios["playlist_o2"] = new scenario;
with (states[ st_n ].scenarios["playlist_o2"]) {
random_delay = 0;
steps[0] = new step( st_n, "PlayListBG.gif", 130, 200, 0);
next_scenarios[0] = new next_scenario("playlist_o3",1);
next_states[0] = new next_state("allScen", "playlist_o3", 1);
next_states[0].action="AMXSubviewSprite6.height='60';";
}
states[ st_n ].scenarios["playlist_o3"] = new scenario;
with (states[ st_n ].scenarios["playlist_o3"]) {
random_delay = 0;
steps[0] = new step( st_n, "PlayListBG.gif", 130, 200, 0);
next_scenarios[0] = new next_scenario("playlist_o4",1);
next_states[0] = new next_state("allScen", "playlist_o4", 1);
next_states[0].action="AMXSubviewSprite6.height='90';";
}
states[ st_n ].scenarios["playlist_o4"] = new scenario;
with (states[ st_n ].scenarios["playlist_o4"]) {
random_delay = 0;
steps[0] = new step( st_n, "PlayListBG.gif", 130, 200, 0);
next_scenarios[0] = new next_scenario("playlist_o5",1);
next_states[0] = new next_state("allScen", "playlist_o5", 1);
next_states[0].action="AMXSubviewSprite6.height='140';";
}
states[ st_n ].scenarios["playlist_o5"] = new scenario;
with (states[ st_n ].scenarios["playlist_o5"]) {
random_delay = 0;
steps[0] = new step( st_n, "PlayListBG.gif", 130, 200, 1);
next_scenarios[0] = new next_scenario("playlist_o6",1);
next_states[0] = new next_state("allScen", "playlist_o6", 1);
next_states[0].action="AMXSubviewSprite6.height='160';";
}
states[ st_n ].scenarios["playlist_o6"] = new scenario;
with (states[ st_n ].scenarios["playlist_o6"]) {
random_delay = 0;
steps[0] = new step( st_n, "PlayListBG.gif", 130, 200, 2);
next_scenarios[0] = new next_scenario("playlist_wait_open",1);
next_states[0] = new next_state("allScen", "playlist_wait_open", 1);
next_states[0].action="AMXSubviewSprite6.height='175';pl.visible='true';";
}
states[ st_n ].scenarios["playlist_wait_open"] = new scenario;
with (states[ st_n ].scenarios["playlist_wait_open"]) {
random_delay = 0;
steps[0] = new step( st_n, "PlayListBG.gif", 130, 200, 20000);
next_scenarios[0] = new next_scenario("playlist_wait_open",1);
next_states[0] = new next_state("allScen", "playlist_wait_open", 1);
}
}
/*#######################
//custom functions
########################*/
function switchScenarioNow(AMXid,scenarioName) {
if (AMXs[AMXid].status.current_scenario_name == scenarioName) {
} else {
AMXs[AMXid].status.current_scenario_name = scenarioName;
AMXs[AMXid].status.step_no = -1 ;
AMXs[AMXid].status.timeout = 0 ;
}
}
function openOptions() {
if(AMXs[0].status.current_scenario_name=="options_wait_open") {
switchScenarioNow(0,"options_close");
} else {
switchScenarioNow(0,"options_open");
}
}
function openPlaylist() {
switchScenarioNow(6,"playlist_o1");
}
function closePlaylist() {
switchScenarioNow(6,"playlist_wait_closed");
pl.visible="false";
AMXSubviewSprite6.visible='false';
}
function closeOptions() {
switchScenarioNow(0,"options_close");
}
function openCloseEQ() {
if(AMXs[1].status.current_scenario_name=="eq_wait_open") {
closeEQ();
} else {
openEQ();
}
}
function openEQ() {
switchScenarioNow(1,"eq_open");
mainView.width="450";
mainView.height="400";
}
function closeEQ() {
switchScenarioNow(1,"eq_close");
closePlaylist();
}
function openCloseAll() {
if (geckosState==0) return;
if ( ( (geckosState==2) || (geckosState==3) ) && (AMXrnd()>0.3) ) return;
if (isOpen) {
closeAll();
isOpen=false;
} else {
openAll();
isOpen=true;
}
}
function openAll() {
switchScenarioNow(0,"options_open");
openEQ();
switchScenarioNow(3,"rightleg_wait_open");
switchScenarioNow(4,"tail_jiggle");
switchScenarioNow(5,"leftleg_wait_open");
}
function closeAll() {
switchScenarioNow(0,"options_close");
switchScenarioNow(1,"eq_close");
switchScenarioNow(3,"rightleg_wait_closed");
switchScenarioNow(4,"tail_wait_closed");
switchScenarioNow(5,"leftleg_wait_closed");
}
function closeLeftLeg() {
switchScenarioNow(5,"leftleg_close");
}
function openLeftLeg() {
switchScenarioNow(5,"leftleg_wait_open");
}
function closeRightLeg() {
switchScenarioNow(3,"rightleg_close");
}
function openRightLeg() {
switchScenarioNow(3,"rightleg_wait_open");
}
function activeCrapouillot(){
if (geckosState==0 ) return;
if (geckosState==3 && AMXrnd()>.3 ) return;
openLeftLeg();
openRightLeg();
}
function animateEye() {
if (AMXs[2].status.current_scenario_name != "main_moving") {
eyeHoverControl.visible="false";
switchScenarioNow(2,"main_moving");
}
}
function animateTail() {
switchScenarioNow(4,"tail_jiggle");
}